package com.xxl.job.consume.utils;

import com.xxl.job.consume.repository.AlarmDefRepository;
import com.xxl.job.consume.service.RedisSequenceService;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;

/**
 * 文件描述
 *
 * @author wang.kunlin
 * @date 2020年06月04日 9:37
 */
public class SequenceUtils {

    static final int DEFAULT_LENGTH = 8;


    public static String getSequence(long seq) {
        String str = String.valueOf(seq);
        int len = str.length();
        if (len >= DEFAULT_LENGTH) {// 取决于业务规模,应该不会到达3
            return str;
        }
        int rest = DEFAULT_LENGTH - len;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < rest; i++) {
            sb.append('0');
        }
        sb.append(str);
        return sb.toString();
    }



}
